<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="java.io.*, java.sql.*, java.util.*,LS.*,date.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	request.setCharacterEncoding("utf-8");
%>
<!DOCTYPE html>
<html lang="UTF-8">
<style>
body,table,tr,td,select,input,div,form,textarea,font{font-family:Mond; font-size=12pt; } 
table {
	width: 100%;
	/* 	margin-left: 20px; */
}

#sasipo {
	width: 45%;
	align: center;
}

#oper {
	width: 10%;
}

.title {
	width: 10%;
	margin: 0px;
}

td,tr {
	font-weight: bolder;
	padding: 10px;
}

#outerview {
	padding-top: 10px;
	margin-left: 0px;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

#outerview {
	width: 100%;
	min-height: 550px;
	padding: 0px;
	padding-bottom: 20px;
}

#middleview {
	width: 90%;
	min-height: 420px;
	margin: 0px auto 0px auto;
	left: 50%;
}

#innerview {
	margin-top: 30px;
	width: 100%;
	min-height: 100%;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

#picture {
	padding-top: 10px;
	width: 200px;
	height: 100%;
	text-align: right;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radi `us: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.btntd {
	text-align: center;
}

.rightdiv {
	text-align: right;
}

#addsuccess {
	border: 1px solid #000000;
}
</style>

<head>
<meta charset="utf-8">
<title>성공회대학교 기자재 대여 시스템</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!-- styles시트 -->
<link href="/LSsystem/assets/css/bootstrap.css" rel="stylesheet">
<link href="/LSsystem/assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="/LSsystem/assets/css/docs.css" rel="stylesheet">


<script type="text/javascript"
	src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript" src="/LSsystem/assets/js/json2.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#checkbtn").click(function() {

			$.ajax({
				type : "POST",
				dataType : "json",
				url : "http://localhost:8080/LSsystem/idCheck.do",
				data : "id=" + $('#equipment_id').val(),
				success : function(msg) {
					var a = $('#equipment_id').val();
					alert(msg.id + ", 일련번호가 존재합니다.");
				},
				error : function(msg) {
					alert("사용 가능합니다.");
				}
			});
		});
		$("#addsuccess").click(function() {

		});
	});

	function mekeDozen(obj) {
		alert("선택한 값은:" + obj.value + "\r\n" +
				"왼쪽에 입련된 기자재와 같은 종류의 기자재의 일련번호를 오른쪽에 적어주세요."
		);
		document.location = 'addEquip.do?num=' + obj.value;
	}

	$(document).ready(init);
</script>
</head>

<body data-spy="scroll" data-target=".bs-docs-sidebar">
	<!-- 메뉴
    ================================================== -->
	<%
		if (session.getAttribute("user") == null) {
	%>
	<jsp:include page="/top.do"></jsp:include>
	<%
		} else {
			Users u = (Users) session.getAttribute("user");
	%>
	<!-- 관리자가 로그인 했을 경우 메뉴 -->
	<jsp:include page="/managertop.do"></jsp:include>
	<%
		}
	%>
	<!-- 게시판
    ================================================== -->

	<div style="text-align: center">
		<div class="marketing"
			style="margin-bottom: 30px; color: #000; text-align: left">
			<div class="container">
				<h3 style="margin: 10px; font-size: 35px;">
					<strong>기자재 추가</strong>
				</h3>
			</div>
		</div>
	</div>
	<div class="container">
		<div id="outerview">
			<div id="middleview">
				<form method="get" action="addEquipLoading.do">
					<div id="innerview">
						<div class="control-gruop" style="text-align: left;">
							<div class="controls">
								<br>
								<table>
									<tr>
										<td class="title">물품명</td>
										<td><select name="item_id" style="width: 200px;">
												<c:forEach var="item" items="${item}">
													<option value="${item.item_id }">${item.item_name}</option>
												</c:forEach>
										</select></td>
										<td rowspan="8" id="oper"><select id="num"
											style="width: auto;" onchange="mekeDozen(this)">
													<option>다중추가</option>
												<c:forEach var="i" begin="1" varStatus="status" end="10">
													<option>${i}</option>
												</c:forEach>
										</select></td>
										<td rowspan="8" id="sasipo">
											<div id="addMore">
												<c:if test="${param.num != null }">
												<% int a = Integer.parseInt(request.getParameter("num")); %>
												<input type="hidden" name="num" value="<%= a %>">
													<c:forEach var="i" begin="1" varStatus="status" end="<%= a %>">
												일련번호 ${i+1} : <input type="text" name="equipment_id${i}">
														<br>
													</c:forEach>
												</c:if>
											</div>
										</td>
										<!--오른쪽 부분 -->
										<!--<td rowspan="5" id="picture"></td> -->
									</tr>
									<tr>
										<td>모델명</td>
										<td><input name="model_name" type="text"
											class="input-middle"></td>
									</tr>
									<tr>
										<td>일련번호</td>
										<td><input type="text" id="equipment_id"
											name="equipment_id" class="input-middle">
											<button type="button" id="checkbtn" class="btn">중복
												확인</button></td>
									</tr>
									<tr>
										<td>가격</td>
										<td><input name="price" type="text" class="input-small">
											원</td>
									</tr>
									<tr>
										<td>입고날짜</td>
										<td><%=getDate.getdate(0)%></td>
									</tr>
									<tr>
										<td>용도</td>
										<td><select name="using_id" style="width: 100px;">
												<c:forEach var="using" items="${using}">
													<option value="${using.using_id }">${using.using }</option>
												</c:forEach>
										</select></td>
										<!-- 										<td class="btntd"> -->
										<!-- 											<button class="btn">사진 추가 +</button> -->
										<!-- 										</td> -->
									</tr>
									<tr>
										<td>학과</td>
										<td><select name="departments_id" style="width: 200px;">
												<c:forEach var="department" items="${department}">
													<option value="${department.departments_id }">${department.departments_name
														}</option>
												</c:forEach>
										</select></td>
									</tr>
									<tr>
										<td>비고</td>
										<td><textarea name="note" rows="5" cols=""
												style="width: 400px"></textarea></td>
									</tr>
								</table>
							</div>
						</div>
					</div>
					<div class="rightdiv">
						<input type="submit" class="btn" id="addsuccess" onclick="makeSentence()" value="추가 완료">
					</div>
				</form>
			</div>
		</div>
	</div>



	<!-- 꼬리말
    ================================================== -->
	<footer class="footer">
		<div class="container">
			<p>Copyright SKHU. Software Student.</p>
		</div>
	</footer>

</body>
<script type="text/javascript" src="/LSsystem/assets/js/bootstrap.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('.dropdown-toggle').dropdown();
	});
</script>
</html>
